"""
生成器

"""


def hello():
    print("hello1")
    yield 111
    print("hello2")
    yield 222
    print("hello1")
    yield 333


def square(num):
    for i in range(1, num):
        yield i ** 2


# g = hello()
# res = next(g)
# print(res)

g = hello()
for d in g:
    print(f"return: {d}")

print("=======")

for res in square(10):
    print(res)